home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
-
- int no_music = FALSE;
-
- void init_music()
- {
- if (!no_music)
- mciSendString("close all", 0, 0, 0);
- }
-
- void deinit_music()
- {
- if (!no_music)
- mciSendString("close all", 0, 0, 0);
- }
-
- void play_music(char *name, int loop)
- {
- if (!no_music)
- {
- stop_music();
-
- if (mciSendString(construct("open %s.MID type sequencer alias MUSIC", name), 0, 0, 0) != 0)
- {
- no_music = TRUE;
- }
- else
- {
- if (loop)
- replay_music();
- else
- mciSendString("play MUSIC from 0", 0, 0, 0);
- }
- }
- }
-
- void replay_music()
- {
- if (!no_music)
- mciSendString("play MUSIC from 0 notify", 0, 0, mainwindowhandle);
- }
-
- void stop_music()
- {
- if (!no_music)
- mciSendString("close MUSIC", 0, 0, 0);
- }
-